Skip to main content

NearestNeighborGraph

NearestNeighborGraph[{elem1,elem2,…}] gives a graph with vertices elem1,elem2,… and edges connecting each elemi to its nearest neighbors.

NearestNeighborGraph[{elem1,elem2,…},k] gives a graph connecting each elemi to its k nearest neighbors.

NearestNeighborGraph[{elem1,elem2,…},{k,r}] gives a graph connecting each elemi to at most k nearest vertices within radius r of elemi.

NearestNeighborGraph[{elem1,elem2,…},{All,r}] gives a graph connecting each elemi to all vertices within radius r of elemi.

Please visit the official Wolfram Language Reference for more details and examples on core symbols.